package top.huxy.boot.util.obj;

import top.huxy.boot.model.entity.User;

/**
 * @Classname ThreadLocalUser
 * @Description ThreadLocalUser
 * @Date 2021/9/24 18:15
 * @Created by huxy
 */
public class ThreadLocalUser {
    private static final ThreadLocal<User> localUser=new ThreadLocal<>();

    public static User current(){
        return localUser.get();
    }
    public static void setCurrentUser(User user){
        localUser.remove();
        localUser.set(user);
    }
    public static void destroy(){
        localUser.remove();
    }
}
